package com.example.demo.controller;

import com.example.demo.pojo.RoomImage;
import com.example.demo.service.impl.RoomImageServiceImpl;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
import io.swagger.annotations.Api;

import javax.annotation.Resource;

/**
 * (RoomImage)表控制层
 *
 * @author Jerry
 * @since 2025-01-19 10:56:27
 */
@RestController
@RequestMapping("/room")
public class RoomImageController {
    /**
     * 服务对象
     */
    @Resource
    private RoomImageServiceImpl roomImageServiceImpl;

    /**
     * 一次性全部查询
     *
     * @return 查询结果
     */
    @GetMapping("/selectAll")
    public Map<String, Object> selectAll() {
        return roomImageServiceImpl.selectAll();
    }

    /**
     * 分页查询
     *
     * @param roomImage 筛选条件
     * @param page        要查询第几页
     * @param limit       每页显示多少条
     * @return 查询结果
     */
    @GetMapping("/selectByLimit")
    public Map<String, Object> selectByLimit(RoomImage roomImage, @RequestParam int page, @RequestParam int limit) {
        return roomImageServiceImpl.selectByLimit(roomImage, page, limit);
    }


    /**
     * 新增数据
     *
     * @param roomImage 实体
     * @return 新增结果
     */
    @PostMapping("/insert")
    public Map<String, Object> insert(@RequestBody RoomImage roomImage) {
        return roomImageServiceImpl.insert(roomImage);
    }

    /**
     * 编辑数据
     *
     * @param roomImage 实体
     * @return 编辑结果
     */
    @PostMapping("/updateById")
    public Map<String, Object> updateById(@RequestBody RoomImage roomImage) {
        return roomImageServiceImpl.updateById(roomImage);
    }

    @PostMapping("/deleteById_t")
    public Map<String, Object> deleteById(@RequestParam int roomInfoId) {
        return roomImageServiceImpl.deleteById(roomInfoId);
    }
}

